#!/bin/sh
set -e

if [ -n "$PDNSDEBUG" ]; then
  echo "now debugging $0 $@"
  set -x
fi

case "$1" in
  configure)
    addgroup --quiet --system pdns
    adduser --quiet --system --home /var/spool/powerdns --shell /bin/false --ingroup pdns --disabled-password --disabled-login --gecos "PowerDNS" pdns
    chown root:pdns /etc/powerdns/pdns.conf || true
    chmod 0640 /etc/powerdns/pdns.conf || true
  ;;

  triggered)
    invoke-rc.d pdns restart || :
  ;;

  abort-upgrade|abort-remove|abort-deconfigure)
  ;;

  *)
    echo "postinst called with unknown argument \`$1'" >&2
    exit 1
  ;;
esac

#DEBHELPER#

exit 0
